﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using IDAL;
using Models;

namespace BLL
{
    public class CareerInfoLogic
    {
        public static ICareerInfo careerinfo = new CareerInfoDAL();
        public static  List<CareerInfo> GetAllCareerInfo()
        {
            List<CareerInfo> list = careerinfo.GetAllCareerInfo();
            for (int i = 0; i < list.Count; i++)
            {
                list[i].ShowID = i + 1;
                list[i].ShowTime = list[i].PublishTime.ToShortDateString();
                if (i % 3 == 1)
                {
                    list[i].RowType = "offerrow lrb";
                }
                else
                {
                    list[i].RowType = "offerrow";
                }
            }
            return list;
        }

        public static int AddCareerInfo(CareerInfo career)
        {
            return careerinfo.AddCareerInfo(career);
        }
        public static CareerInfo GetOneCareerInfo(int id)
        {
            return careerinfo.GetOneCareer(id);
        }
        public static int UpdateCareerInfo(CareerInfo career)
        {
            return careerinfo.UpdateCareerInfo(career);
        }
        public static int DeleteCareerInfo(int cid)
        {
            return careerinfo.DeleteCareerInfo(cid);
        }
    }
}
